﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using WindowsGame1.GameComponents;

namespace WindowsGame1
{
    class Room
    {
        //room contents
        List<CollidableObject> enemies;
        List<CollidableObject> environment;
        List<CollidableObject> item_entities;

        Random rand = new Random();

        public bool north = false;
        public bool south = false;
        public bool east = false;
        public bool west = false;

        Boolean cleared = false; //if the room has been cleared, 

        public Room()
        {
            enemies = new List<CollidableObject>();
            environment = new List<CollidableObject>();
            item_entities = new List<CollidableObject>();

            cleared = false;
        }

        public void LoadInto(EntityManager em)
        {
            if(!cleared)
                em.SetEnemies(enemies);

            em.SetItemEntities(item_entities);
            em.SetEnvironment(environment);

            em.SetRoom(this);
        }

        public void AddEnemy(CollidableObject enemy)
        {

            enemy.Position = new Microsoft.Xna.Framework.Vector2(rand.Next(100, 600),rand.Next(100, 400));
            enemies.Add(enemy);
            
        }

        public void Clear()
        {
            cleared = true;
        }

        public override string ToString()
        {
            string output = "";
            if (north)
                output += 'N';
            if (south)
                output += 'S';
            if (east)
                output += 'E';
            if (west)
                output += 'W';
            return output;
        }
    }
}
